import requests as req
import json
import logging

logging.basicConfig(level=logging.INFO)

verify_url = "url"

def check(sid, pwd) :

    logging.info("TEST [%s] [%s]" % (sid, pwd))

    data = {
        "password": pwd,
        "loginNo": sid
    }

    try :
        verify_res = req.post(verify_url, headers={"Content-Type": "application/json"}, data=json.dumps(data))
    except :
        return -1
    
    if verify_res.status_code != 200 :
        return -1

    res_data = json.loads(verify_res.text)["datas"];

    if res_data["message"] and res_data["message"][0] == "x" :
        return 0
    else :
        return 1

if __name__ == "__main__" :

    sid = input("请输入账号: ")

    while(True) :

        pwd = input("请输入密码: ")
        if (pwd == "exit") :
            break
        elif (pwd == "change") :
            sid = input("请输入账号")
        else :
            check(sid, pwd)